home *** CD-ROM | disk | FTP | other *** search
/ Vampire's Kiss / Vampire's Kiss.iso / pc / vampire.rul < prev    next >
Text File  |  1994-09-30  |  18KB  |  559 lines

  1. //
  2. //      Vampire's Kiss v1.5 CD  Installation Script
  3. //      by Terry R. Schussler
  4. //      (c) 1994 by gray matter design.  All rights reserved.
  5. //
  6. //      Notes: Requires ~500K of hard disk space to install
  7. //
  8.  
  9.  
  10.     /*--------------------------------------------------------*/
  11.     /*                  Constant Declarations                 */
  12.     /*--------------------------------------------------------*/
  13. #define STD_MAX_SIZE         500
  14. #define LARGE_STRING         5000
  15.  
  16. #define TOTAL_HD_FILE_SIZE     2000000
  17. #define TOTAL_CD_FILE_SIZE     1000000
  18. #define ALT_FILE_SIZE         50000
  19. #define BASE_FILE_SIZE       125000
  20.  
  21.     /*--------------------------------------------------------*/
  22.     /*                  Variable Declarations                 */
  23.     /*--------------------------------------------------------*/
  24. declare
  25.  
  26.     string  szText[ LARGE_STRING ], szDefPath[ STD_MAX_SIZE ];
  27.     string  szResultPath[ STD_MAX_SIZE ];
  28.     string  szDisk[ 50 ], szFileName[ STD_MAX_SIZE ];
  29.     string  szBitmapPath[ STD_MAX_SIZE ];
  30.     string  szErrMsg [ STD_MAX_SIZE ];
  31.     string  szErrFile [ STD_MAX_SIZE ];
  32.     string  szREADME [ STD_MAX_SIZE ];
  33.     string  szDir[ STD_MAX_SIZE ];
  34.     string  szQTWPath[ STD_MAX_SIZE ];
  35.     string  szPath[ STD_MAX_SIZE ];
  36.     string  szIconPath[ STD_MAX_SIZE ];
  37.     string  szBMPPath[ STD_MAX_SIZE ];
  38.     string  szProgramPath[ STD_MAX_SIZE ];
  39.     string  szDrive[ STD_MAX_SIZE ];
  40.     string  szText2[ LARGE_STRING ];
  41.     string  szResult[ LARGE_STRING ];
  42.     string  szWorkingDir[ STD_MAX_SIZE ];
  43.     string  szA[ STD_MAX_SIZE ];
  44.     string  szB[ STD_MAX_SIZE ];
  45.     string  szC[ STD_MAX_SIZE ];
  46.     string  szD[ STD_MAX_SIZE ];
  47.     string  szE[ STD_MAX_SIZE ];
  48.     string  szF[ STD_MAX_SIZE ];
  49.  
  50.     string  gWinCDDrive[ 5 ];
  51.     string  gWinInstallLoc[ 5 ];
  52.     number  gWinProcessor;
  53.  
  54.     number  nHDSpaceRequired;
  55.     number  nCDSpaceRequired;
  56.     number  nFileHandle;
  57.     number  nNumber;
  58.         number  nResult;
  59.  
  60.         number    nCDROM;
  61.         number    nHARDDISK;
  62.         number    nDx;
  63.         number    nDy;
  64.         number    nvD;
  65.         number    nvF;
  66.  
  67.         number    QTWlist;
  68.  
  69.  
  70. program /* Must use program keyword to start the statements */
  71.  
  72.  
  73. Start:
  74.        Enable( DEFWINDOWMODE );
  75.        Handler( EXIT, HandleExit );
  76.  
  77.        // Set the color of the back to be BLACK
  78.        //SetColor( BACKGROUND, RGB(0,0,0) ); default is BLACK
  79.  
  80.        SetColor( STATUSBAR, RGB(255,0,0) );
  81.        SetFont( FONT_TITLE, STYLE_BOLD, "Helv" );
  82.  
  83.        SetTitle( "Vampire's Kiss INSTALLER", 45, BACKGROUNDCAPTION );
  84.        SetStatusWindow( 0, "Beginning installation process..." );
  85.  
  86.        // Enable various objects.
  87.        //Enable( BITMAPFADE );    // All bitmaps will fade into the screen.
  88.  
  89.        PlaceWindow( EXIT, 10, 10, LOWER_RIGHT );
  90.        Enable( EXIT );          // Exit Button
  91.  
  92.        PlaceWindow( STATUS, 0, 0, UPPER_LEFT );
  93.        Enable( STATUS );        // Status, % Complete Bar Window
  94.  
  95.        GetExtents( nDx, nDy ); // how big is the screen
  96.        nDx = nDx - 100;
  97.        nDy = nDy - 340;
  98.        SizeWindow( INFO, nDx, nDy );
  99.        PlaceWindow( INFO, 0, 0, LOWER_LEFT );
  100.        Enable( INFO );          // Info Windows
  101.  
  102.        Enable( BITMAP256COLORS );          // 256 color display
  103.        Enable( INDVFILESTATUS );          // filename display
  104.  
  105.        GetExtents( nDx, nDy ); // how big is the screen
  106.        SizeWindow( BACKGROUND, nDx, nDy );
  107.        PlaceWindow( BACKGROUND, 0, 0, UPPER_LEFT );
  108.        Enable( BACKGROUND );    // Display background and all windows
  109.  
  110.         // In Info Window to display the .lis information
  111.        SetInfoWindow( "Vampire's Kiss Installer Information", "vampire.LIS" );
  112.  
  113.        // Determine target location for hard disk files
  114.        GetDisk( TARGETDIR, szDisk );
  115.        szDefPath = SRCDIR;
  116.  
  117.        nHDSpaceRequired = TOTAL_HD_FILE_SIZE;
  118.        nCDSpaceRequired = TOTAL_CD_FILE_SIZE;
  119.  
  120. DrawBitmaps:
  121.     // Place logo on the screen
  122.     StrCopy( szBMPPath, SRCDIR );
  123.     AppendToPath( szBMPPath, "vampire.BMP" );
  124.     PlaceBitmap( szBMPPath, 101, 0, 0, UPPER_LEFT );
  125.  
  126.     Disable( BITMAPFADE );  // Bitmaps will now be drawn and not faded in
  127.  
  128.  
  129. TargetLoc:
  130.        SetStatusWindow( 0, "Installing Vampire's Kiss..." );
  131.  
  132. BeginInstall:
  133.        GetDisk( TARGETDIR, szDisk );
  134.  
  135.  
  136. CheckDiskSpace:
  137.        // Check to see if enough space is free on the destination.
  138.        // GetDiskSpace returns free space in LAST_RESULT.
  139.        GetDiskSpace( szDisk );
  140.        if LAST_RESULT > nCDSpaceRequired goto EnoughSpace;
  141.  
  142.   szText = "There is not enough space on drive " + szDisk + 
  143. "\nto install Vampire's Kiss as requested.";
  144.   MessageBox( szText, WARNING );
  145.     StrCopy( TARGETDIR, SRCDIR );
  146.     DeleteFile( "sync.fil" );
  147.  
  148.     exit;
  149.  
  150.  
  151. EnoughSpace:
  152.  
  153.        call TestTargetDrive;
  154.        call QuickTimeInstall;
  155.        //call FileTransfer;
  156.        //call FontInstall;
  157.        //call PrefsMaker;
  158.        call finishInstall;
  159.  
  160. endInstall:
  161.  
  162.        SetDialogTitle( DLG_MSG_INFORMATION, "Successful Installation!" );
  163. szText = "Vampire's Kiss has just been successfully installed. " +
  164.          " Don't forget to read the ReadMe file for last minute information!";
  165.        MessageBeep( 0 );
  166.        MessageBox( szText, INFORMATION ); // Get the user to acknowledge success
  167.  
  168.        ShowGroup( "Digital Playground", SW_NORMAL );
  169.        StrCopy( TARGETDIR, SRCDIR );
  170.        DeleteFile( "sync.fil" );
  171.        
  172. szText = "Click YES to restart your computer to complete installation." +
  173.          " If your computer fails to reboot, you may need to turn" +
  174.          " it off and on again to reboot.";
  175.        AskYesNo(szText, YES);
  176.     if LAST_RESULT = YES then
  177.           System( SYS_BOOTMACHINE );
  178.           exit;  //Exit installation program.
  179.     else
  180. szText = "Warning: You will need to reboot to have Vampire's Kiss installed.";
  181.       MessageBeep( 0 );
  182.       SetDialogTitle( DLG_MSG_WARNING, "Reboot Reminder!" );
  183.       MessageBox( szText, WARNING );
  184.           exit;
  185.     endif;
  186.  
  187.  
  188. //-----------------------------------------------------------------------------
  189. //
  190. //      Name:       DirExists
  191. //
  192. //      Descrip:    This procedure ensures the CD is still in the drive.
  193. //
  194. //      Params:
  195. //
  196. //-----------------------------------------------------------------------------
  197. DirExists:
  198.        SetStatusWindow( 0, "Continuing installation..." );
  199.        StrCopy( TARGETDIR, szResultPath );
  200.  
  201.        // Check to see if INSTALL.INS exists on the CD
  202.        // If it does, then it must the right disk.
  203.  
  204.        StrCopy( szText, SRCDIR );
  205.        AppendToPath( szText, "SETUP.INS" );
  206.        GetFileInfo( szText, FILE_DATE, nNumber, szText2 );
  207.        if LAST_RESULT != FALSE then
  208.  
  209.        // Ask user to enter a disk in drive.
  210.  
  211.      szText = "Please insert the Vampire's Kiss CD...";
  212.      SetDialogTitle( DLG_ENTER_DISK, "CD-ROM Disc Request" );
  213.      EnterDisk( szText, "setup.ins");
  214.  
  215.      if LAST_RESULT != TRUE then
  216.         call ConfirmCancel;  // Call to confirm cancel
  217.         goto DirExists;      // returned, therefore continue
  218.      endif;
  219.        endif;
  220.      return;
  221.  
  222.  
  223. //-----------------------------------------------------------------------------
  224. //
  225. //      Name:       TestTargetDrive
  226. //
  227. //      Descrip:    This will make sure the boot drive is writable
  228. //
  229. //      Params:
  230. //
  231. //-----------------------------------------------------------------------------
  232. TestTargetDrive:
  233.  
  234. // put something else which will test the boot drive's writability
  235.  
  236. return; 
  237.  
  238. //-----------------------------------------------------------------------------
  239. //
  240. //      Name:       FileTransfer
  241. //
  242. //      Descrip:    This procedure will handle the file transfer for this
  243. //                  installation.
  244. //
  245. //      Params:
  246. //
  247. //-----------------------------------------------------------------------------
  248. FileTransfer:
  249.  
  250.  
  251. return;
  252.  
  253. //////////////////////////////////////////////////////////////////
  254. //
  255. //      QuickTimeInstall
  256. //
  257. //      Ask the user if we can install the required QTW files.
  258. //      If he is agreeable install it
  259. //----------------------------------------------------------------
  260.       
  261. QuickTimeInstall:
  262.  
  263. szText = "Vampire's Kiss requires QuickTime v1.1.1 to run properly." +
  264.          " Click YES to install QuickTime v1.1.1 and add its path to your" +
  265.          " AUTOEXEC.BAT file.";
  266.     
  267.   AskYesNo(szText, YES);
  268.     if LAST_RESULT = YES then
  269.       call CopyQuickTime;
  270.     else
  271. szText = "Warning: You will need QuickTime v1.1.1 installed to properly" +
  272.          " run Vampire's Kiss.";
  273.       MessageBeep( 0 );
  274.       SetDialogTitle( DLG_MSG_WARNING, "QuickTime Reminder!" );
  275.       MessageBox( szText, WARNING );
  276.     endif;
  277.  
  278. return;
  279.  
  280. //////////////////////////////////////////////////////////////////
  281. //
  282. //      finishInstall
  283. //
  284. //      
  285. //----------------------------------------------------------------
  286.  
  287. finishInstall:
  288.  
  289. // Put the .ICO into the Windows directory //
  290.        StrCopy( TARGETDIR, WINDIR);
  291.  
  292.        StatusUpdate( ON, 100);
  293.        SetStatusWindow( 99, "Copying file ... vampire.ICO" );
  294.        CopyFile( "vampire.ICO", "vampire.ICO" );
  295.        if LAST_RESULT < 0 then
  296.       StrCopy( szErrFile, "vampire.ICO" );
  297.       call CopyError;
  298.        endif;
  299.  
  300. // This creates a Windows Program Group
  301.        CreateProgGroup( "Digital Playground" );
  302.        szProgramPath = SRCDIR ^ "vampire.EXE";
  303.        szIconPath = WINDIR ^ "vampire.ICO";
  304.  
  305.        if ( QueryProgItem( "Digital Playground", "Vampire's Kiss", szA, szB, szC, nvD, szE, nvF ) = 0 ) then
  306. ParsePath( szWorkingDir, szProgramPath, PATH);
  307. ReplaceProgItem( "Digital Playground", "Vampire's Kiss", "Vampire's Kiss", szProgramPath, szWorkingDir, szIconPath, 0, "", RUN_MINIMIZED);
  308.        else
  309. AddProgItem( "Digital Playground", "Vampire's Kiss", szProgramPath, szIconPath);
  310.        endif;
  311.        szProgramPath = SRCDIR ^ "README.WRI";
  312.        if ( QueryProgItem( "Digital Playground", "Vampire's Kiss Read Me", szA, szB, szC, nvD, szE, nvF ) = 0 ) then
  313. ParsePath( szWorkingDir, szProgramPath, PATH);
  314. ReplaceProgItem( "Digital Playground", "Vampire's Kiss Read Me", "Vampire's Kiss Read Me", szProgramPath, szWorkingDir, "", 0, "", RUN_MINIMIZED);
  315.        else
  316. AddProgItem( "Digital Playground", "Vampire's Kiss Read Me", szProgramPath, "");
  317.        endif;
  318.  
  319.        StatusSetPercent( STATUS, 100 );// Installation is done
  320.        Disable( STATUS );
  321.  
  322. return;
  323.  
  324. //////////////////////////////////////////////////////////////////
  325. //
  326. //      CopyQuickTime:
  327. //
  328. //      Install the required QTW files.
  329. //     
  330. //----------------------------------------------------------------
  331. //----------------------------------------------------------------
  332.  
  333. CopyQuickTime:
  334.  
  335. //   QuickTime for Windows needs to be installed
  336.  
  337.      StatusUpdate( ON, 8);
  338.      SetStatusWindow( 7, "Searching for QuickTime for Windows..." );
  339.  
  340.       GetDisk(WINDIR, szDisk);
  341.       StrCopy(szQTWPath, szDisk);
  342.       StrConcat(szQTWPath, "\\QTW");
  343.  
  344. // first check for any existing QTIM.DLL files on TargetDrive
  345.  
  346.      QTWlist = ListCreate( STRINGLIST );
  347.      nResult = FindAllFiles( szDisk, "QTIM.DLL", szFileName, RESET );
  348.      while ( nResult = 0 )
  349.        ParsePath( szText2, szFileName, PATH );
  350.        // add each found path for QuickTime to the list
  351.        ListAddString( QTWlist, szText2, AFTER );
  352.        nResult = FindAllFiles( szDisk, "QTIM.DLL", szFileName, CONTINUE );
  353.      endwhile;
  354.      // if we found any releases of QuickTime, display the locations
  355.      if (ListCount( QTWlist ) > 0 ) then
  356.        szText = "The QuickTime for Windows software was\n" +
  357.                 "found in the following location(s):\n";
  358.        nResult = ListGetFirstString( QTWlist, szText2 );
  359.        while (nResult = 0 )
  360.          szText = szText + szText2 + "\n";
  361.          nResult = ListGetNextString( QTWlist, szText2 );
  362.        endwhile;
  363.        szText = szText + "\nYou may wish to remove these files" +
  364.                 " from your system if they are not in use.";
  365.      SetDialogTitle( DLG_MSG_INFORMATION, "QuickTime for Windows Found" );
  366.        MessageBox( szText, INFORMATION );
  367.      endif;
  368.      ListDestroy( QTWlist );
  369.  
  370. // Check to see if Directory Exists
  371.  
  372.     ExistsDir(szQTWPath);
  373.     if LAST_RESULT = EXISTS goto QTWDirExists;
  374.     CreateDir(szQTWPath);
  375.     if LAST_RESULT = EXISTS goto QTWDirExists;
  376.     szText = "Cannot create QuickTime directory." +
  377.                  " - Aborting installation.";
  378.     MessageBox( szText, WARNING );
  379.     StrCopy( TARGETDIR, SRCDIR );
  380.     DeleteFile( "sync.fil" );
  381.  
  382.     exit;
  383.  
  384. QTWDirExists:
  385.  
  386.        // Check to see if QTIM.DLL exists in the QuickTime
  387.        // directory. If it doesn't, then install QuickTime.
  388.  
  389.        StrCopy( szText, szQTWPath );
  390.        AppendToPath( szText, "QTIM.DLL" );
  391.        GetFileInfo( szText, FILE_DATE, nNumber, szText2 );
  392.  
  393.        // The directory is empty, so we will install our version.
  394.  
  395.        if LAST_RESULT != FALSE then
  396.  
  397.        // Copy the files to szQTWPath
  398.  
  399.      StrCopy(TARGETDIR, szQTWPath);
  400.  
  401.      StatusUpdate( ON, 96);
  402.      SetStatusWindow( 9, "Decompressing QuickTime files ..." );
  403.      DeCompress( "QTIME.LI$", "" );
  404.      if LAST_RESULT < 0 then
  405.         StrCopy( szErrFile, "QTIME.LI$" );
  406.         call CopyError;
  407.      endif;
  408.        else
  409.          // QuickTime is installed already.
  410.          // Which version is it?
  411.          if szText2 < "1994/01/11" then
  412.            szText2 = "An older";
  413.          elseif szText2 > "1994/01/11" then
  414.            szText2 = "A newer";
  415.          else
  416.            szText2 = "The same";
  417.          endif;
  418. szText = szText2 + " version of QuickTime" +
  419.          " is already installed in the \\QTW directory," +
  420.          " so I will not install version 1.1.1 of QuickTime.\n\n" +
  421.          " If you wish to install version 1.1.1, you must erase" +
  422.          " the files found in the \\QTW directory, then re-run" +
  423.          " the Vampire's Kiss installer.";
  424.      MessageBeep( 0 );
  425.      SetDialogTitle( DLG_MSG_WARNING, "QuickTime Already Installed!" );
  426.      MessageBox( szText, WARNING );
  427.        endif;
  428.  
  429.        StrCopy(TARGETDIR, WINDIR);
  430.        StatusUpdate( ON, 100);
  431.     SetStatusWindow( 96, "Copying file ... QTW.INI");
  432.     CopyFile( "QTW.INI", "QTW.INI" );
  433.     if LAST_RESULT < 0 then
  434.         StrCopy(szErrFile, "QTW.INI" );
  435.         call CopyError;
  436.     endif;
  437.  
  438. // Now install things in the user specified directory
  439.        StrCopy( TARGETDIR, szDefPath );
  440.  
  441.  
  442. // Now back up the user's AUTOEXEC.BAT file to AUTOEXEC.OLD
  443.  
  444.        BatchGetFileName( szText );
  445.        GetDisk( szText, szText2 );
  446.        StrConcat( szText2, "\\AUTOEXEC.OLD" );
  447.        BatchFileLoad( szText );
  448.        BatchFileSave( "AUTOEXEC.OLD" );
  449.        szText = "Your AUTOEXEC.BAT file has been backed up to " +
  450.        INFOFILENAME + " and a new AUTOEXEC.BAT has been created.";
  451.        MessageBeep( 0 );
  452.        SetDialogTitle( DLG_MSG_INFORMATION, "AUTOEXEC.BAT Modification Note" );
  453.        MessageBox( szText, INFORMATION );
  454.  
  455. // Add QuickTime path to the AUTOEXEC.BAT file
  456. //    EzBatchAddPath("PATH", SRCDIR, "", BEFORE);
  457.     EzBatchAddPath("PATH", szQTWPath, "", BEFORE);
  458.  
  459. //--end of QuickTime installation section
  460.  
  461. return;
  462.  
  463.  
  464. //-----------------------------------------------------------------------------
  465. //
  466. //      Name:       PrefsMaker
  467. //
  468. //      Descrip:    This procedure will create the LINGO.INI file
  469. //
  470. //      Params:
  471. //
  472. //-----------------------------------------------------------------------------
  473. PrefsMaker:
  474.  
  475.  
  476. return;
  477.  
  478.  
  479. //-----------------------------------------------------------------------------
  480. //
  481. //      Name:       ConfirmCancel
  482. //
  483. //      Descrip:    This will as the users if they want to terminate the
  484. //                  installation.
  485. //
  486. //      Params:
  487. //
  488. //-----------------------------------------------------------------------------
  489. ConfirmCancel:
  490.  
  491.       AskYesNo( "Are you sure you want to CANCEL installation ?", FALSE );
  492.  
  493.       if LAST_RESULT = FALSE then return; endif;
  494.  
  495.       StrCopy( szText, "Installation has been cancelled." );
  496.       MessageBeep( 0 );
  497.       SetDialogTitle( DLG_MSG_WARNING, "Aborted Installation Warning!" );
  498.       MessageBox( szText, WARNING );
  499.  
  500.       StrCopy( TARGETDIR, SRCDIR );
  501.       DeleteFile( "sync.fil" );
  502.       exit;
  503.  
  504. return;
  505.  
  506. //-----------------------------------------------------------------------------
  507. //
  508. //      Name:       CopyError
  509. //
  510. //      Descrip:    This will be invoked when an error occurs during a
  511. //                  file transfer operation.
  512. //
  513. //      Params:     szErrFile
  514. //
  515. //-----------------------------------------------------------------------------
  516. CopyError:
  517.  
  518.   StrCopy( szErrMsg, "Unable to copy or decompress file: ");
  519.   StrConcat( szErrMsg, szErrFile);
  520.   MessageBeep( 0 );
  521.   SetDialogTitle( DLG_MSG_SEVERE, "Problem Occurred!" );
  522.   MessageBox( szErrMsg, SEVERE );
  523.  
  524. return;
  525.  
  526. //-----------------------------------------------------------------------------
  527. //
  528. //      Name:       HandleExit
  529. //
  530. //      Descrip:    This will be invoked when the exit button is hit.
  531. //                  Normally you would use the default option IS provides
  532. //                  but this provides you the ability to perform
  533. //                  cleanup operations.  Here we are deleting the
  534. //                  synchronizing file.
  535. //
  536. //      Params:
  537. //
  538. //-----------------------------------------------------------------------------
  539. HandleExit:     // This will handle the exit button
  540.  
  541.     AskYesNo( "Are you sure you want to exit?", FALSE );
  542.     if LAST_RESULT = NO then
  543.        return;
  544.     endif;
  545.  
  546.     StrCopy( szText, "You may need to delete Vampire's Kiss " );
  547.     StrConcat( szText, "files which were installed into the " );
  548.     StrConcat( szText, szResultPath );
  549.     StrConcat( szText, " directory." );
  550.     MessageBeep( 0 );
  551.     SetDialogTitle( DLG_MSG_WARNING, "Aborted Installation Warning!" );
  552.     MessageBox( szText, WARNING );
  553.  
  554.     StrCopy( TARGETDIR, SRCDIR );
  555.     DeleteFile( "sync.fil" );
  556.  
  557.     exit;
  558.  
  559.